package com.inspur.jzsxxzx.entity.catalog;

import java.util.Date;

public class DataBasicElemCatalogItem {
    /**
     * 所属基本要素目录ID
     */
    private String cataId;
    
    /**
     * 所属基本要素目录版本号
     */
    private Integer cataVersion;
    
    /**
     * 数据项编码
     */
    private String columnCode;
    
    /**
     * 数据项名称
     */
    private String nameCn;
    
    /**
     * 数据格式
     */
    private String dataFormat;
    
    /**
     * 创建时间
     */
    private Date createTime;
    
    // 复合主键类
    public static class PrimaryKey {
        private String cataId;
        private String columnCode;
        private Integer cataVersion;
        
        public PrimaryKey() {}
        
        public PrimaryKey(String cataId, String columnCode, Integer cataVersion) {
            this.cataId = cataId;
            this.columnCode = columnCode;
            this.cataVersion = cataVersion;
        }
        
        // Getter和Setter方法
        public String getCataId() {
            return cataId;
        }
        
        public void setCataId(String cataId) {
            this.cataId = cataId;
        }
        
        public String getColumnCode() {
            return columnCode;
        }
        
        public void setColumnCode(String columnCode) {
            this.columnCode = columnCode;
        }
        
        public Integer getCataVersion() {
            return cataVersion;
        }
        
        public void setCataVersion(Integer cataVersion) {
            this.cataVersion = cataVersion;
        }
        
        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            
            PrimaryKey that = (PrimaryKey) o;
            
            if (cataId != null ? !cataId.equals(that.cataId) : that.cataId != null) return false;
            if (columnCode != null ? !columnCode.equals(that.columnCode) : that.columnCode != null) return false;
            return cataVersion != null ? cataVersion.equals(that.cataVersion) : that.cataVersion == null;
        }
        
        @Override
        public int hashCode() {
            int result = cataId != null ? cataId.hashCode() : 0;
            result = 31 * result + (columnCode != null ? columnCode.hashCode() : 0);
            result = 31 * result + (cataVersion != null ? cataVersion.hashCode() : 0);
            return result;
        }
    }
    
    // 构造函数
    public DataBasicElemCatalogItem() {}
    
    public DataBasicElemCatalogItem(String cataId, String columnCode, Integer cataVersion) {
        this.cataId = cataId;
        this.columnCode = columnCode;
        this.cataVersion = cataVersion;
    }
    
    // Getter和Setter方法
    public String getCataId() {
        return cataId;
    }
    
    public void setCataId(String cataId) {
        this.cataId = cataId;
    }
    
    public Integer getCataVersion() {
        return cataVersion;
    }
    
    public void setCataVersion(Integer cataVersion) {
        this.cataVersion = cataVersion;
    }
    
    public String getColumnCode() {
        return columnCode;
    }
    
    public void setColumnCode(String columnCode) {
        this.columnCode = columnCode;
    }
    
    public String getNameCn() {
        return nameCn;
    }
    
    public void setNameCn(String nameCn) {
        this.nameCn = nameCn;
    }
    
    public String getDataFormat() {
        return dataFormat;
    }
    
    public void setDataFormat(String dataFormat) {
        this.dataFormat = dataFormat;
    }
    
    public Date getCreateTime() {
        return createTime;
    }
    
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    
    // 获取复合主键对象
    public PrimaryKey getPrimaryKey() {
        return new PrimaryKey(cataId, columnCode, cataVersion);
    }
}